package cn.java.exercises;

public class RankingList
{
    public static void main(String[] args)
    {
        int nScores[]={ 365,401,406,455,389,378,376,303,289,405,
                        465,411,306,459,479,388,346,335,299,415,
                        485,403,407,469,471,438,396,345,369,408,
                        395,409,417,429,478,428,394,426,466,418,
                        393,463,429,464,441,458,386,395,348,447
                      };
        int nRanks[]={ 1,2,3,4,5,6,7,8,9,10,
                      11,12,13,14,15,16,17,18,19,20,
                      21,22,23,24,25,26,27,28,29,30,
                      31,32,33,34,35,36,37,38,39,40,
                      41,42,43,44,45,46,47,48,49,50
                    };
        String sNames[]={"陈奕","何春容","李琪霞","陈珍珍","虞喆斯","张颖","赵超群","吴丽萍","潘丹琴","巫梦婷",
                         "余梢婷","余丽君","胡梦诗","范玲娇","丰凯怡","张红梅","虞鑫悦","周佳慧","连青坡","沙孟",
                         "张道阳","陈宇航","陈瀚犇","陈明星","庄凌","胡清扬","劳一鸣","林总涛","陈斌","方开渊",
                         "胡斌","金阿青","马杰","董滨杰","马圆涛","姚仕纲","朱鸿扬","胡康鹏","崔俊杰","沃雪野",
                         "祝俊儿","张宏鑫","丁玲钰","彭嘉慧","毛利燕","周烯烯","吴霞芸","郑洁儿","徐书晴","杨丽珍"
                        };

        int k,nTemp;

        for (int i = 0; i < 50; i++)
        {
            for (int j = i+1; j < 50; j++)
            {
                if(nScores[i] < nScores[j])
                {
                    nTemp=nScores[i];
                    nScores[i]=nScores[j];
                    nScores[j]=nTemp;
                    k=nRanks[i];
                    nRanks[i]=nRanks[j];
                    nRanks[j]=k;
                }
            }
        }

        System.out.println("一等奖学金获得者：");
        for (int i = 0; i < 2; i++)
        {
            System.out.println("名次:"+(i+1)+"    学号:"+nRanks[i]+"    姓名:"+sNames[nRanks[i]-1]+"    分数:"+nScores[i]);
        }

        System.out.println("二等奖学金获得者：");
        for (int i = 2; i < 6; i++)
        {
            System.out.println("名次:"+(i+1)+"    学号:"+nRanks[i]+"    姓名:"+sNames[nRanks[i]-1]+"    分数:"+nScores[i]);
        }

        System.out.println("三等奖学金获得者：");
        for (int i = 6; i < 15; i++)
        {
            System.out.println("名次:"+(i+1)+"    学号:"+nRanks[i]+"    姓名:"+sNames[nRanks[i]-1]+"    分数:"+nScores[i]);
        }
    }
}
